Access Policies and Search Bundle Responses
# support
d
Hello! I had a question regarding access policies and how to correctly set them up for the use case that I need. I set an access policy for all resources that my application needs access to: "resource": [ { "resourceType": "Task" }, { "resourceType": "Encounter" }, { "resourceType": "Patient" }, { "resourceType": "Practitioner" }, { "resourceType": "ServiceRequest" }, { "resourceType": "Organization" }, { "resourceType": "Location" }, { "resourceType": "Consent" }, { "resourceType": "Communication" } ] But I'm unable to perform the following search successfully: https://api.medplum.com/fhir/R4/Task?_include=Task:based-on&_include=Task:owner&_include=Task:patient&_include=Task:requester&encounter=dc5f63a1-74c1-4d15-8583-247c27414e7f I just get a bundle with the above link. I've tried adjusting the access policy a few different ways but haven't been able to get any of the requested resources back from that search. Even simplifying it to just look for the Task with that encounter ID does not return anything other than the link. Would anyone be able to take a look and let me know what I should modify, either with the access policy or the search itself?
r
@dovah_queen The FHRI Search APi always returns a bundle resource as a container for the results
The key is to look inside the
Bundle.entry
field to see which resources are returned
d
@rahul1 the response body does not contain any entries
@rahul1 For reference, this is an example of a response that I get when I try to search: { "resourceType": "Bundle", "type": "searchset", "link": [ { "relation": "self", "url": "https://api.medplum.com/fhir/R4/Task?_count=20&requester=9dede856-a4df-42c9-b5aa-5cea12ae83be" } ] }
r
r
@dovah_queen a good way to test is: 1. log into the Medplum App with the user with those access policies appliued
2. Go to
app.medplum.com/Task
3.Use the
filter
section at the top to construct the filter required
4. Copy the search params into your API -based search
d
@reshma @rahul1 When I do that, I get an html response: Medplum
I was able to inspect the page when applying filters and copy the request from the network tab, which worked 👍
2227 Views